package com.gw.websocket.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

//定义一个配置类
@Configuration
@EnableWebSocket
public class WebSocketConfig {
    /**
     *  注入一个ServerEndpointExporter对象，该bean会自动注册使用@ServerEndpoint注解
     * @return
     */
    @Bean
    public ServerEndpointExporter serverEndpoint() {
        return new ServerEndpointExporter();
    }
}

